
pkgname=hdparm
pkgver=9.56
pkgrel=1
pkgdesc="A shell utility for manipulating Linux IDE drive/driver parameters"
arch=('x86_64')
url="https://sourceforge.net/projects/hdparm/"
license=('BSD')
depends=('glibc')
optdepends=('sh: required by idectl and ultrabayd')
source=("https://downloads.sourceforge.net/sourceforge/hdparm/${pkgname}-${pkgver}.tar.gz"
        'wiper.sh.2_6.max-ranges.patch')
options=('emptydirs')
md5sums=('7900608e32834f65d2654fdb696e71a0'
         'd91213801094931a02e54283cb1b7375')

build() {
  cd ${pkgname}-${pkgver}
  patch -p1 -i $srcdir/wiper.sh.2_6.max-ranges.patch
  
  make
}

package() {
  cd ${pkgname}-${pkgver}

  mkdir -p ${pkgdir}/{usr,sbin}
  make DESTDIR=${pkgdir} install
  install -m755 contrib/idectl ${pkgdir}/sbin
  install -m755 contrib/ultrabayd ${pkgdir}/sbin

  install -D -m 0644 wiper/README.txt ${pkgdir}/usr/share/doc/wiper/README.txt
  install -D -m 0755 wiper/wiper.sh ${pkgdir}/usr/sbin/wiper.sh
  install -D -m 644 LICENSE.TXT ${pkgdir}/usr/share/licenses/hdparm/LICENSE.TXT
}
